package com.example.rpapp.record.query;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.rpapp.assembler.RecordAssembler;
import com.example.rpclient.dto.data.RecordVo;
import com.example.rpclient.dto.query.RecordListByParamQuery;
import com.example.rpdomain.gateway.RecordGateway;
import com.example.rpdomain.record.RecordEntity;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@AllArgsConstructor
public class RecordListByParamQueryExe {

    private final RecordGateway recordGateway;

    public IPage<RecordVo> execute(RecordListByParamQuery query) {
        IPage<RecordEntity> page = recordGateway.page(query);
        return page.convert(RecordAssembler::toRecordVO);
    }
}
